<template>
  <div>
    <ul>
      <li v-for='i in list' :key="i">{{ i.name }}
        <van-button v-if="i.status == 1" @click='audit(i.id)'>审核</van-button>
        <van-button v-else>已审核</van-button>
      </li>
    </ul>

    <!-- <van-dialog v-model:show="show" title="标题" show-cancel-button>
            <img src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
          </van-dialog> -->

    <van-dialog v-model:show="show" title="标题" show-cancel-button>

      <van-field :label='描述信息' v-model='descipt'/>
      <van-radio-group v-model="is_agree">
        <van-radio name="2">通过</van-radio>
        <van-radio name="3">未通过</van-radio>
      </van-radio-group>
      <van-button @click='submit'>提交</van-button>
    </van-dialog>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: "customer",
  data() {
    return {
      list: [],
      show: false,
      descipt: '',
      is_agree: 2,
      id: 0,
    }
  },
  methods: {
    getlist() {
      axios.get('http://localhost:8000/showuseraudit').then(res => {
        this.list = res.data.list
      })
    },
    audit(id) {
      this.id = id
      this.show = true
    },
    submit() {
      axios.post('http://localhost:8000/audit', {
        'id': this.id,
        'descipt': this.descipt,
        'is_agree': this.is_agree
      }).then(res => {
        console.log(res)
      })
    }
  },
  mounted() {
    this.getlist()
  },
}
</script>

<style scoped>

</style>